package com.mzz.creational.factory.simple.commonfactory;

/**
 * “发送” 工厂模式
 * @author xushijian
 * @date 18/5/16
 */
public class SendFactory {

    public Sender produce(String type) {
        Sender sender = null;
        if ("mail".equals(type)) {
            sender = new MailSender();
        } else if ("sms".equals(type)) {
            sender = new SmsSender();
        } else {
            System.out.println("类型不匹配，不能创建发送对象");
        }
        return sender;
    }

}
